﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace UniRx.Examples
{
	// Token: 0x020001F1 RID: 497
	public class Sample12_ReactiveProperty : MonoBehaviour
	{
		// Token: 0x06000A66 RID: 2662 RVA: 0x00037CD0 File Offset: 0x000360D0
		private void Start()
		{
			this.MyButton.onClick.AsObservable().Subscribe(delegate(Unit _)
			{
				this.enemy.CurrentHp.Value -= 99L;
			});
			this.MyToggle.OnValueChangedAsObservable().SubscribeToInteractable(this.MyButton);
			(from x in this.MyInput.OnValueChangedAsObservable()
			where x != null
			select x).Delay(TimeSpan.FromSeconds(1.0)).SubscribeToText(this.MyText);
			this.MySlider.OnValueChangedAsObservable().SubscribeToText(this.MyText, (float x) => Math.Round((double)x, 2).ToString());
			this.enemy.CurrentHp.SubscribeToText(this.MyText);
			(from isDead in this.enemy.IsDead
			where isDead
			select isDead).Subscribe(delegate(bool _)
			{
				Selectable myToggle = this.MyToggle;
				bool interactable = false;
				this.MyButton.interactable = interactable;
				myToggle.interactable = interactable;
			});
			this.IntRxProp.SubscribeToText(this.MyText);
		}

		// Token: 0x040006CA RID: 1738
		public Button MyButton;

		// Token: 0x040006CB RID: 1739
		public Toggle MyToggle;

		// Token: 0x040006CC RID: 1740
		public InputField MyInput;

		// Token: 0x040006CD RID: 1741
		public Text MyText;

		// Token: 0x040006CE RID: 1742
		public Slider MySlider;

		// Token: 0x040006CF RID: 1743
		public IntReactiveProperty IntRxProp = new IntReactiveProperty();

		// Token: 0x040006D0 RID: 1744
		private Enemy enemy = new Enemy(1000);
	}
}
